package com.neu.cloudfactory.controler;

import com.neu.cloudfactory.bean.Order.Recevier;
import com.neu.cloudfactory.repository.RecevierRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RecevierControler {
    @Autowired
    RecevierRepository recevierRepository;

    @RequestMapping("/recevier/findAll")
    public Page<Recevier> findAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size) {
        Pageable pageable = PageRequest.of(page-1,size);
        return recevierRepository.findAll(pageable);
    }
}
